const path = require('path');
const TypedocWebpackPlugin = require('typedoc-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");

const appPath = (...names) => path.join(process.cwd(), ...names);
//const extractJs = new ExtractTextPlugin('stylesheets/[name]-one.css');
//const extractCss = new ExtractTextPlugin('stylesheets/[name]-two.css');



//This will be merged with the config from the flavor
module.exports = {
    entry: {
        main: [
            appPath('node_modules/todomvc-common', 'base.css'),
            appPath('node_modules/todomvc-app-css', 'index.css'),
            appPath('node_modules/todomvc-common', 'base.js'),
            appPath('src', 'index.ts'),
            appPath('src', 'css', 'styles.scss')
        ]
    },
    output: {
        filename: 'bundle.[hash].js',
        path: appPath('build')
    },
    plugins: [
        new TypedocWebpackPlugin({
            out: '../doc/typedoc',
            module: 'commonjs',
            target: 'es6',
            mode: 'modules',
            includeDeclarations: false,
            ignoreCompilerErrors: true,
            excludePrivate: false,
            exclude: '(**/node_modules|.history)/**/*.*',
        }, ['./src']),
        // new HtmlWebpackPlugin({
        //     template: './index.html',
        //     filename: './index.html',
        // })
    ]
};
